/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aso.upna.config;

import java.io.File;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.net.SocketException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author triki
 */
public class ClientConfig {

    private String pathToSharedFolder;
    private int TcpPort;
    private int UdpPort;
    private File tmpFile;

    private ServerSocket sock;
    private DatagramSocket dsock;

    private final int datagram_size = 2048;

    public ClientConfig(String shared,int TcpPort,int UdpPort)
    {
        try {
            pathToSharedFolder = new String(shared);
            this.TcpPort = TcpPort;
            this.UdpPort = UdpPort;
            tmpFile = File.createTempFile("mp3_", ".temp");
        } catch (IOException ex) {
           ex.printStackTrace();
        }
    }

    public void createServerSocket() throws IOException
    {
        sock = new ServerSocket(TcpPort);
    }

    public void createUdpSocket() throws SocketException
    {
        dsock = new DatagramSocket(UdpPort);
    }

    public ServerSocket getServerSocket()
    {
        return sock;
    }

    public DatagramSocket getDatagramSocket()
    {
        return dsock;
    }

    public int getTcpPort()
    {
        return TcpPort;
    }

    public int getUdpPort()
    {
        return UdpPort;
    }

    public int getDatagramSize()
    {
        return datagram_size;
    }

    public String getPathToTempFile()
    {
        return tmpFile.getAbsolutePath();
    }

    public String getPathToSharedFolder()
    {
        return this.pathToSharedFolder;
    }
}
